package gsutil

import (
	"encoding/json"
)

var JsonUtil = &jsonUtil{}

type jsonUtil struct {
}

func (x *jsonUtil) Marshal(data any) string {
	res, err := json.Marshal(data)
	if err != nil {
		panic(err)
	}

	return string(res)
}

func (x *jsonUtil) Unmarshal(data string, v any) {
	err := json.Unmarshal([]byte(data), v)
	if err != nil {
		panic(err)
	}
}
